# this is jus to check the conversion of parameters from cost-reduction specification to the conformity one
# used in converting theta_vec to chi_vec and then manually added values to parameters_writeout_CONFORM.csv
chi_5_out<- with(parameters_readin, -estimate[par_name=="theta_vec2"]/(estimate[par_name=="beta_vec2"] - estimate[par_name=="theta_vec1"]))

chi_4_out<- with(parameters_readin, -(estimate[par_name=="theta_vec2"]/chi_5_out)/(1 + (estimate[par_name=="theta_vec2"]/chi_5_out)))

chi_3_out<-1 # fixed because it's a normalization

chi_2_out<- with(parameters_readin, estimate[par_name=="theta_vec4"] * (1 + chi_4_out))

chi_1_out<- with(parameters_readin, estimate[par_name=="theta_vec3"] * (1 + chi_4_out) + estimate[par_name=="beta_vec2"])

# in case this code is useful when checking comparison with cost-reduction specification
# compute reduced form policy function
# intercept
(with(parameters_readin, estimate[par_name=="beta_vec2"]) - chi_1_out) / (1+chi_4_out)

# intercept heterogeneity
-chi_2_out / (1+chi_4_out)

# slope
chi_4_out / (1 + chi_4_out)

# slope heterogeneity
chi_4_out / (1 + chi_4_out) * chi_5_out